const apiBase = "https://api.it120.cc/dhw"

// var tokenKey = "token";
// // 登录地址, 根据这个地址来设置token
// var logInUrl = "/Account/LogInForMiniProgram";

export const Request = (params) => {
  wx.showLoading({
    title: '加载中',
  })
  return new Promise((resolve, reject) => {
    wx.request({ 
      ...params,
      url: apiBase + params.url,
      header:{
        'content-type':'application/x-www-form-urlencoded'
      },
      success: (data) => {
        resolve(data.data)  
        wx.hideLoading({
          fail(err){
            console.log(err)
          }
        });   
      },
      fail: (err) => {
        reject(err)
      },
      // complete: wx.hideLoading
    })
  })
}